package ui;

import java.awt.Component;

import javax.swing.DefaultCellEditor;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;

@SuppressWarnings("serial")
public class ObjetoCellEditor extends DefaultCellEditor {
	
	public ObjetoCellEditor() {
		super(new JTextField());
		super.setClickCountToStart(1);
	}
	
	@Override
	public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
	    final JTextField ec = (JTextField) editorComponent;     
	    String textValue = (String)value;       
	    ec.setText(textValue);      
	    SwingUtilities.invokeLater( new Runnable() {
	        @Override
	        public void run() {
	            ec.selectAll();
	        }
	    });     
	    return editorComponent;
	}

}